package com.fowo.api.common.model;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Getter;
import lombok.Setter;

import java.util.Map;

/**
 * 标准分页返回加自由的 Map 统计数据
 * @author yl_ls
 * @param <T> 页记录类型
 */
@Getter
@Setter
public class PageAndStatistics<T> extends Page<T> {

    /**
     * 统计值信息
     */
    private Map<String, Object> statistics;

    public static <T> PageAndStatistics<T> of(long current, long size) {
        return of(current, size, 0);
    }

    public static <T> PageAndStatistics<T> of(long current, long size, long total) {
        PageAndStatistics<T> page = new PageAndStatistics<>();
        page.setCurrent(current);
        page.setSize(size);
        page.setTotal(total);
        return page;
    }
}
